home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3895 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.chattanooga.net!usenet
  2. From: "Eric W. Bradway" <ebradway@microsports.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What's wrong here?
  5. Date: Wed, 31 Jan 1996 13:33:35 -0500
  6. Organization: Micro Sports, Inc.
  7. Message-ID: <310FB5FF.4BE6@microsports.com>
  8. References: <4eml5o$o6h@airdmhor.gen.nz>
  9. NNTP-Posting-Host: 205.244.28.38
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (Win95; I)
  14.  
  15. Simon Hosie wrote:
  16. >   Watcom gives the following warnings (and _only_ those warnings) compiling
  17. > the above code (except without the line numbers or colons), but only when
  18. > it's compiling it as C++ and generating 32 bit code (GCC doesn't, no matter
  19. > how hard I try).  I don't know C++ myself, but my flatmate is learning it,
  20. > does it have anything to do with the typedef?
  21. > TEST.CPP(12): Warning! W389: (col 15) integral value may be truncated during
  22. >               assignment or initialization
  23. > TEST.CPP(17): Warning! W389: (col 15) integral value may be truncated during
  24. >               assignment or initialization
  25.  
  26. The typedef doesn't matter. Try turning off the optimizer (-od). Lines 
  27. 12 is where a, b, c are first used and the uncasted numeric constants 
  28. are being resolved. Again, at line 17, d is being access (not 
  29. assigned?!?) for the first time.
  30.  
  31. You may be able to clear everything up by changing lines 9-11 to:
  32.   a = (word) 1;
  33.   b = (word) 2;
  34.   c = (word) 3;
  35.  
  36. In my experience, WATCOM gives more warnings about this sort of thing 
  37. than any other C/C++ compiler I've worked with. It also defaults to full 
  38. optimizations which can have strange effects on your code (usually not 
  39. your warnings however).
  40.  
  41. -Eric
  42.